/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package seGobangClient.mainMenu;
import seGobangClient.*;
import java.util.*;

/**
 *
 * @author plus
 */
public class MainMenuController implements ISceneController{
    private static HashMap <String,ICommand> CommandsPool;
    private static IMainMenuScene Scene;                //可视场景

    public MainMenuController(IUISystem Scene) {
        this.Scene=(IMainMenuScene)Scene;
        Scene.setCurrentController(this);
        Scene.currentSceneChangeTo("MainMenu");
        if (CommandsPool==null) blendCommands();
    }
    
    public void blendCommands() {
        CommandsPool=new HashMap <String,ICommand>();
        CommandsPool.put("ChangeSceneToLocalGame", new CommandChangeSceneToLocalGame());
        CommandsPool.put("ChangeSceneToAIGame", new CommandChangeSceneToAIGame());
        CommandsPool.put("ChangeSceneToConfigMenu", new CommandChangeSceneToConfigMenu());
        CommandsPool.put("ChangeSceneToOnlineHall", new CommandChangeSceneToOnlineHall());
        CommandsPool.put("ExitGame", new CommandExitGame());
    }

    public Object doEvent(String CommandName, Object Param) {
        try{
            CommandsPool.get(CommandName).execute(Param);
        }catch(Exception e){
            e.printStackTrace();
        }
        return null;
    }
    
}
